package com.study.zzedu.fragment.center;

import android.content.Context;

import com.study.zzedu.base.BasePresenter;
import com.study.zzedu.base.BaseView;
import com.study.zzedu.http.OnResultListener;

/**
 * Created by kiros on 2020/9/3.
 */

public class StudyCenterPresenter extends BasePresenter<StudyCenterContract.IView> {

    private StudyCenterModel sModel;

    public StudyCenterPresenter() {
        this.sModel = new StudyCenterModel();
    }

    public void getUserInfo(Context context ) {
        sModel.getUserInfo(context,new OnResultListener() {
            @Override
            public void onSuccess(String result) {
                getView().getData(result);
            }

            @Override
            public void onError(String error) {
                getView().showError(error);
            }
        });
    }

    public void logout(Context context ) {
        sModel.logout(context,new OnResultListener() {
            @Override
            public void onSuccess(String result) {
                getView().getLogoutBack(result);
            }

            @Override
            public void onError(String error) {
                getView().showError(error);
            }
        });
    }

}
